import VueRouter from "vue-router";

import Vue from "vue";

//解决路由导航到统一路径重复报错的问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

//将路由注入到所有子节点
Vue.use(VueRouter);

//定义路由配置
//路由配置是一个数组，数组中是一个一个对象，每个对象通过一个path对应一个component
const routes = [
  {
    path: "/login",
    component: () => import(/*webpackChunkName:"login"*/ "../pages/Login"),
  }
];

//实例化路由
export default new VueRouter({
  // mode: "history",
  routes,
});
